home *** CD-ROM | disk | FTP | other *** search
/ ASP Advantage 1994 2nd Q2 / The Association of Shareware Professionals - The Official ASP Advantage (2nd Quarter)(1994).bin / files / utilstem / boot202 / samples / autoexec.rpt < prev    next >
Encoding:
Text File  |  1994-01-06  |  12.5 KB  |  481 lines

  1. rem  This is my actual autoexec.bat provided to Hans Salvisberg as a
  2. rem  "real world" example of BOOT.SYS usage.  It is the companion to
  3. rem  my config.sys file provided separately.
  4.  
  5. rem  The fact that my chosen command processor is 4DOS (JP Software) rather
  6. rem  than command.com makes this autoexec much easier to set up.
  7. rem  The DR/MS DOS independence would have been very complicated, clumsy,
  8. rem  and difficult without 4DOS.   The autoexec file relies heavily upon
  9. rem  4DOS features to create a readable, maintainable structure.
  10.  
  11. rem  A key feature of the style is the use of common subroutines to do things
  12. rem  which are repeated for each configuration such as loading TSRs and
  13. rem  setting variables.
  14.  
  15. rem  Any program names, etc., which happen to be trademarks are, of course, the
  16. rem  property of their owners.
  17.  
  18. rem  No copyright is claimed, but acknowledgment of my authorship would be
  19. rem  appreciated in any copies or derivative works.
  20.  
  21. rem  Raymond P. Tackett (CIS 76416,276)
  22.  
  23. @echo off
  24. c:\bootbeta\boot SET /X
  25. if errorlevel 10 pause
  26. mode con: rate=32 delay=1
  27. goto %boot%
  28.  
  29. rem **********************************************************************
  30. rem *                  NORMAL OPERATION                                  *
  31. rem **********************************************************************
  32.  
  33. :normal
  34. :as400
  35. gosub prebtm
  36. cls
  37. loadbtm on
  38. gosub postbtm
  39. if not isalias in alias /R %compath%aliases.500
  40. 60
  41. unset compath
  42. if "%boot%" == "AS400" goto doas400
  43. gosub edset
  44. iff %_ansi == 0 then
  45.  prompt $h$P$g
  46. else
  47.  gosub setpromp
  48. endiff
  49. goto exit
  50.  
  51. rem **********************************************************************
  52. rem *                       WINDOWS 3                                    *
  53. rem **********************************************************************
  54.  
  55. :windows
  56. gosub prebtm
  57. cls
  58. loadbtm on
  59. gosub postbtm
  60. if not isalias in alias /R %compath%aliases.500
  61. unset compath
  62. win3\
  63. win
  64. echo 15 seconds to reboot, Q to quit
  65. inkey /w15 %%x
  66. if "%@upper[%x]" == "Q" quit
  67. reboot
  68. goto exit
  69.  
  70. rem **********************************************************************
  71. rem *                      AS/400                                        *
  72. rem **********************************************************************
  73.  
  74. :doas400
  75. dos6fix
  76. to %pcs
  77. inkey /W15 Use folders? (y/N/q) %%folder
  78. iff "%folder" ne "" then
  79.  set folder=%@upper[%folder]
  80. else
  81.  set folder=N
  82. endiff
  83. if %folder eq Q quit
  84. inkey /W15 Use printer? (y/N/q) %%printer
  85. iff "%printer" ne "" then
  86.  set printer=%@upper[%printer]
  87. else
  88.  set printer=N
  89. endiff
  90. if %printer eq Q quit
  91. inkey /W15 Use PC Support? (y/N/q) %%pcspt
  92. iff "%pcspt" ne "" then
  93.  set pcspt=%@upper[%pcspt]
  94. else
  95.  set pcspt=N
  96. endiff
  97. if %pcspt eq Q quit
  98. 25
  99. uv oldengl
  100. cls
  101. uvcolors blue
  102. uv /s
  103. call nofolder
  104. echo 15 seconds to reboot, Q to quit
  105. inkey /w15 %%x
  106. if "%@upper[%x]" == "Q" quit
  107. reboot
  108. goto exit
  109.  
  110. rem **********************************************************************
  111. rem *                         VANILLA                                    *
  112. rem **********************************************************************
  113.  
  114. :vanilla
  115. path c:\ramdisk;%path%
  116. goto vanexit
  117.  
  118. rem **********************************************************************
  119. rem *                      TEST JUNK                                     *
  120. rem **********************************************************************
  121.  
  122. :test
  123. gosub cdpath
  124. tape\
  125. quit
  126.  
  127. rem **********************************************************************
  128. rem *                         BACKUPS                                    *
  129. rem **********************************************************************
  130.  
  131. :backups
  132. loadbtm on
  133. gosub cdpath
  134. gosub setramd
  135. gosub postbtm
  136. if not isalias in alias /R %compath%aliases.500
  137. unset compath
  138. prompt BACKUPS $P$g
  139. tape\
  140. goto exit
  141.  
  142. rem **********************************************************************
  143. rem *               END OF BOOT ALTERNATIVES                             *
  144. rem **********************************************************************
  145.  
  146. :exit
  147. quit
  148.  
  149. rem **********************************************************************
  150. rem *                     COMMON SUBROUTINES                             *
  151. rem **********************************************************************
  152.  
  153.  
  154. rem                            PREBTM
  155. rem
  156. rem Do everything that needs to be done before loadbtm on
  157.  
  158. :prebtm
  159. gosub cdpath
  160. gosub setramd
  161. %ramd%
  162. gosub tsrload
  163. return
  164.  
  165. rem                            POSTBTM
  166. rem
  167. rem Do common set after loadbtm on
  168.  
  169. :postbtm
  170. gosub setvars
  171. gosub ramspec
  172. return
  173.  
  174. rem                            TSRLOAD
  175. rem
  176. rem Key features:
  177. rem               TSRs and their resident sizes are on a single list.
  178. rem               Specifics for each are isolated to one place.
  179. rem               The load syntax adjusts itself for the memory manager
  180. rem                   in use (even if there isn't one!).
  181. rem
  182. :tsrload
  183.  
  184. rem Set up for memory manager specifics.
  185.  
  186. iff "%mgr" == "QEMM" then
  187.    set lh=%[drp]loadhi /b
  188.    set sqz=/sqf
  189.    set res=/res=
  190.  elseiff "%mgr" == "MAX" then
  191.    set lh=g:\386max\386load
  192.    set lhp=PROG=
  193.    set sqz=FLEXFRAME
  194.    set res=size=
  195.  elseiff "%mgr" == "DOS" then
  196.    set lh=lh
  197.  else
  198.    rem no memory manager in use
  199. endiff
  200.  
  201. rem Load the TSRs from list.  Sizes line up below each TSR. Below sizes
  202. rem      are configurations under which to load (bootyes) and not to
  203. rem      load (bootno).
  204.  
  205. set tsrlist=fast    uv      dmp     files   kstack  4dos24h  prtsc    mode1    mode2
  206. set sizlist=32768   19972   14176   5072    1184    2240     384      512      512
  207. set bootyes=all     all     none    all     all     all      all      all      all
  208. set  bootno=none    windows windows windows windows windows  windows  windows  windows
  209. set  hiload=yes     yes     yes     yes     yes     yes      yes      yes      no
  210. set squeeze=yes     yes     no      no      no      no       no       no       no
  211. set count=0
  212.  
  213. rem Top of the loading loop
  214.  
  215. :tsrloop
  216.  
  217. rem Use the 4DOS @word function to pick off the parameters for a TSR
  218.  
  219. set tsl=%@word[%count,%tsrlist]
  220.  
  221. rem Check for end of loop.  Note that a hard coded count value is NOT used.
  222. rem All we do is see if we're off the end of the string.
  223.  
  224. if "%tsl%" == "" goto tsrexit
  225.  
  226. rem Not off the end of the world yet, pick up the reasons NOT to load ...
  227.  
  228. set yes=%@upper[%@word[%count,%bootyes]]
  229. set no=%@upper[%@word[%count,%bootno]]
  230.  
  231. rem ... and see if any of the reasons not to load are true.
  232.  
  233. if "%yes" ne "%@upper[%boot]" .and. "%yes" ne "ALL" goto tsrbump
  234. if "%no" eq "%@upper[%boot]" goto tsrbump
  235.  
  236. rem Use the TSR's logical name from tsrlist to call the appropriate
  237. rem subroutine for the command line switches.  The subroutine also
  238. rem has the right to return an empty string as a signal not to load.
  239.  
  240. gosub %tsl
  241.  
  242. rem Check the "don't load" signal (empty command string)
  243.  
  244. if "%tsc" == "" goto tsrbump
  245.  
  246. rem Set up the resident size portion of the load high command, if any.
  247.  
  248. iff "%res%" ne "" then
  249.   set ressiz=%@word[%count,%sizlist]
  250.  else
  251.   set ressiz=
  252. endiff
  253.  
  254. rem load a tsr with sleaze to minimize environment size -- QEMM workaround
  255.  
  256. rem set the squeeze parameter
  257. iff "%@upper[%@word[%count,%squeeze]]" == "YES" then
  258.   set sqp=%sqz%
  259.  else
  260.   set sqp=
  261. endiff
  262.  
  263. rem save the command we want to do
  264. iff "%@upper[%@word[%count,%hiload]]" == "NO" then
  265.   echo %tsc% > load.cmd
  266.  else
  267.   echo %lh% %sqp% %res%%ressiz% %lhp%%tsc% > load.cmd
  268. endiff
  269.  
  270. rem save all the variables
  271. set > envsave
  272. rem clear out everything
  273. unset *
  274. rem do the command straight from the file
  275. %@line[load.cmd,0]
  276. rem restore the variables
  277. set /r envsave
  278.  
  279. rem TSRBUMP loop increment point whether we loaded anything or not
  280. :tsrbump
  281. set count=%@eval[%count + 1]
  282. goto tsrloop
  283.  
  284. :tsrexit
  285. if exist load.cmd erase /q load.cmd
  286. if exist envsave erase /q envsave
  287. unset mgr sqz res lh lhp ressiz yes no tsc sqp squeeze >& NUL
  288. unset tsrlist sizlist bootyes bootno count hiload >& NUL
  289. return
  290.  
  291. rem
  292. rem                     %TSL SUBROUTINES (TSR PROGRAM SPECIFICS)
  293. rem
  294. :UV
  295. set tsc=g:\uv\uv.com
  296. return
  297. rem
  298. :PRTSC
  299. set tsc=g:\uv\prtsc.com page
  300. return
  301. rem
  302. :DMP
  303. set tsc=%drp%dmp /COM2 R9600 WCTS /T+ /G+ /MXP /MX:4 /D%ramd%
  304. return
  305. rem
  306. :FILES
  307. set tsc=%drp%files +80
  308. return
  309. rem
  310. :KSTACK
  311. set tsc=%drp%kstack.com
  312. return
  313. rem
  314. :4DOS24H
  315. set tsc=%drp%4dos24h
  316. return
  317. rem
  318. :FAST
  319. rem Check for another cache loaded .OR. a signal from config.sys
  320. rem to load FAST!
  321. iff "%cache" eq "" .or. "%cache" eq "FAST" then
  322.   set cache=FAST
  323.   set con=f:\fastbeta\fast E
  324.   set coff=f:\fastbeta\fast D
  325.   set tsc=f:\fastbeta\fastx C:2048 HK:OFF P:0 SWB:8 S T:1 XMS
  326.  else
  327.   rem If a cache is already loaded, signal "no load" for this betazoid
  328.   set tsc=
  329. endiff
  330. return
  331. rem
  332. :MODE1
  333. rem Use the 4DOS @search command to scan the path for the correct MODE.COM
  334. rem (MS-DOS or DR-DOS).  PATH is set correctly in config.sys for the DOS
  335. rem  in use.
  336. set tsc=%@search[mode] com2:96,N,8,1,B
  337. return
  338. rem
  339. :MODE2
  340. set tsc=%@search[mode] lpt2=com2
  341. return
  342. rem
  343. rem                     FIND RAMDISK AND SET RAMD
  344. rem
  345. :setramd
  346. rem The last disk letter which is ready, not removable, and not remote
  347. rem is the ramdisk (or the last HD partition which will serve as the
  348. rem logical ramdisk if a driver is not loaded.
  349. set work=ZYXWVUTSRQPONMLKJIHGFEDC
  350. rem Start with the last drive.
  351. set count=%@index[%work,%_lastdisk]
  352. iff count lt 0 then
  353.   rem last drive is a diskette (A or B)
  354.   set ramd=%_boot\ramdisk
  355.   goto ramdexit
  356. endiff
  357.  
  358. :ramdloop
  359. set foo=%@substr[%work,%count,1]:
  360. rem Find highest drive letter that isn't a removable Bernoulli or CD-ROM.
  361. rem Allow for possible future networking as well.
  362. iff %@ready[%foo] == 1 .and. %@removable[%foo] == 0 .and. %@remote[%foo] == 0 then
  363.   set ramd=%foo
  364.   rem Copy everything to the ramdisk.
  365.   pushd ramdisk
  366.   copy *.* %ramd% /s /q >& NUL
  367.   popd
  368.   unset work count foo
  369.   goto ramdexit
  370.  else
  371.   set count=%@eval[%count+1]
  372. endiff
  373. iff %count lt 24 then
  374.  goto ramdloop
  375. else
  376.  rem This whole process fell apart for some reason.
  377.  rem Fail gracefully, but warn the user.
  378.  pause SETRAMD processing failed to find a disk!
  379.  set ramd=%_boot:\ramdisk
  380.  unset count work foo
  381.  goto ramdexit
  382. endiff
  383. :ramdexit
  384. return
  385.  
  386.  
  387. rem                           SET CDPATH
  388.  
  389. :cdpath
  390. rem The object of the game is to end up with CDPATH set to:
  391. rem C:\;D:\<etc. to last drive letter>
  392. set work=CDEFGHIJKLMNOPQRSTUVWXYZ
  393. set count=1
  394. set cdpath=C:\
  395. :cdloop
  396.   set d=%@substr[%work,%count,1]:
  397. rem  if beyond last     OR   beyond end of %work string
  398.   if %d gt %_lastdisk: .or. "%d" == ":" goto cdexit
  399.   set cdpath=%[cdpath];%d\
  400.   set count=%@eval[%count+1]
  401. goto cdloop
  402. :cdexit
  403. unset work count d
  404. return
  405.  
  406.  
  407. rem                           SET PROMPT
  408.  
  409. rem This part is horrendously complicated and mostly unnecessary, but
  410. rem the end result looks pretty.
  411. rem
  412. :setpromp
  413. rem prompt $P$g^return^rem test code
  414. iff "%_ansi" ne "1" then
  415.   prompt $P$g^quit
  416. endiff
  417. iff %_shell == 0 then
  418.   *set n=Primary
  419. else
  420.   *set n=Shell: $z
  421. endiff
  422. if "%mr"=="" *set mr=512
  423. if "%me"=="" *set me=64
  424. if "%mx"=="" *set mx=1024
  425. set a=$e[s$e[1;1f$e[0;0;34;47m$e[K$e[1;`%%@int[%%@eval[(%%_columns-74)/2]]`f $t $b $D $b
  426. set b=$e[0;0;34;47m RAM:`%%@dosmem[K]`K
  427. set c= $b$e[0;0;34;47m EMS:`%%@ems[K]`K
  428. set d= $b$e[0;0;34;47m XMS:`%%@xms[K]`K
  429. set e= $b `%%[n]`$e[u$e[0;0;37;44m$P$g
  430. prompt %[a]%[b]%[c]%[d]%[e]
  431. unset a b c d e
  432. return
  433.  
  434.  
  435. rem                     SET STANDARD VARIABLES
  436.  
  437. rem This could be done faster via set /r.  Personal preference at work!
  438. rem I'd rather maintain it here than in a separate file.
  439. rem
  440. :setvars
  441. if  "%cspec" ne "" (set comspec=%cspec ^ unset cspec)
  442. set temp4dos=%ramd%\
  443. set temp=%ramd%\
  444. set tmp=%ramd%\
  445. set pktmp=%ramd%\
  446. set uv=%ramd%\
  447. path %ramd%\;.;%path
  448. return
  449.  
  450.  
  451. rem                     PUT COMSPEC ON RAMDISK
  452.  
  453. :ramspec
  454. copy %comspec% %ramd%
  455. set comspec=%ramd\%@name[%comspec].%@ext[%comspec]
  456. return
  457.  
  458.  
  459. rem                     SET EDITOR DU JOUR
  460.  
  461. rem This part is also unnecessary for most users, but I fool around with
  462. rem different text editors sometimes and I just want to type "edit <file>"
  463. rem no matter what editor I'm playing with at the moment.  All the different
  464. rem editors I might use (including three not listed here) are set up with
  465. rem identical key/mouse mappings.
  466.  
  467. :edset
  468. rem there's an alias named EDIT which uses %ed to decide what to use
  469. rem set ed=g:\boxer\b.exe
  470. rem set BOXER=-b -c -dg:\boxer -j -k0 -r -s -4 -6 -7
  471. pushd me
  472. set ed=%[_cwds]me
  473. popd
  474. set me_dflt=/KN
  475. return
  476.  
  477.  
  478. rem                     EXIT POINT FOR TOTAL VANILLA
  479.  
  480. :vanexit
  481.